import request from '@/config/axios'

// 合同付款计划明细 VO
export interface ContractPaymentPlanDetailVO {
  id: number // 主键
  paymentPlanId: number // 关联付款计划主表ID
  planNo: string // 付款计划编号
  period: string // 付款期数
  planDate: Date // 计划付款日期
  paymentType: string // 付款类型
  planPaymentRatio: number // 计划付款比例(%)
  planPaymentAmount: number // 计划付款金额
  actualPaymentStatus: string // 实际付款状态
  actualAmount: number // 实际付款金额
  actualDate: Date // 实际付款日期
}

// 合同付款计划明细 API
export const ContractPaymentPlanDetailApi = {
  // 查询合同付款计划明细分页
  getContractPaymentPlanDetailPage: async (params: any) => {
    return await request.get({ url: `/erp/contract-payment-plan-detail/page`, params })
  },

  // 查询合同付款计划明细详情
  getContractPaymentPlanDetail: async (id: number) => {
    return await request.get({ url: `/erp/contract-payment-plan-detail/get?id=` + id })
  },

  // 新增合同付款计划明细
  createContractPaymentPlanDetail: async (data: ContractPaymentPlanDetailVO) => {
    return await request.post({ url: `/erp/contract-payment-plan-detail/create`, data })
  },

  // 修改合同付款计划明细
  updateContractPaymentPlanDetail: async (data: ContractPaymentPlanDetailVO) => {
    return await request.put({ url: `/erp/contract-payment-plan-detail/update`, data })
  },

  // 删除合同付款计划明细
  deleteContractPaymentPlanDetail: async (id: number) => {
    return await request.delete({ url: `/erp/contract-payment-plan-detail/delete?id=` + id })
  },

  // 导出合同付款计划明细 Excel
  exportContractPaymentPlanDetail: async (params) => {
    return await request.download({ url: `/erp/contract-payment-plan-detail/export-excel`, params })
  },
}
